local HitLight = {
	Sound("physics/flesh/flesh_impact_bullet1.wav"),
	Sound("physics/flesh/flesh_impact_bullet2.wav"),
	Sound("physics/flesh/flesh_impact_bullet3.wav"),
	Sound("physics/flesh/flesh_impact_bullet4.wav"),
	Sound("physics/flesh/flesh_impact_bullet5.wav")
}

local HitMedium = {
	Sound("devin/blackbetty/player/body_impact/body_medium_impact_hard1.wav"),
	Sound("devin/blackbetty/player/body_impact/body_medium_impact_hard2.wav"),
	Sound("devin/blackbetty/player/body_impact/body_medium_impact_hard3.wav"),
	Sound("devin/blackbetty/player/body_impact/body_medium_impact_hard4.wav"),
	Sound("devin/blackbetty/player/body_impact/body_medium_impact_hard5.wav"),
	Sound("devin/blackbetty/player/body_impact/body_medium_impact_hard6.wav")
}

local HitHard = {
	Sound("physics/body/body_medium_break2.wav"),
	Sound("physics/body/body_medium_break3.wav"),
	Sound("physics/body/body_medium_break4.wav")
}

local HitMega = {
	Sound("physics/flesh/flesh_squishy_impact_hard2.wav"),
	Sound("physics/flesh/flesh_squishy_impact_hard3.wav"),
	Sound("physics/flesh/flesh_squishy_impact_hard4.wav")
}

local Hit_Voices = {
	Sound("devin/blackbetty/player/male/takedamage1.wav"),
	Sound("devin/blackbetty/player/male/takedamage2.wav"),
	Sound("devin/blackbetty/player/male/takedamage3.wav"),
	Sound("devin/blackbetty/player/male/takedamage4.wav")
}

local HitHard_Voices = {
	Sound("devin/blackbetty/player/male/takedamagebig1.wav"),
	Sound("devin/blackbetty/player/male/takedamagebig2.wav"),
}

local DamageSoundDelay = 0.2
local VoiceDelay = 0.8

-- called in shared.lua

function PlayerInjured( ent, dmginfo )
	local atk = dmginfo:GetAttacker()
	if(!ent.NextVoice or !ent.NextDamageSound)then
		ent.NextVoice = 0
		ent.NextDamageSound = 0
	end
	local dt = dmginfo:GetDamage()
	if(ent:IsPlayer() and ent:Alive())then
		if(ent.NextDamageSound < CurTime())then
			if(dt > 10 and dt < 20)then
				ent:EmitSound(HitLight[math.random(1, #HitLight)], 140, 100+math.random(-10,10))
				ent.NextDamageSound = CurTime() + DamageSoundDelay
			elseif(dt >= 20 and dt <= 35)then
				ent:EmitSound(HitHard[math.random(1, #HitHard)], 140, 100+math.random(-10,10))
				ent.NextDamageSound = CurTime() + DamageSoundDelay
				if(ent.NextVoice < CurTime())then
					ent.NextVoice = CurTime() + VoiceDelay
					ent:EmitSound(HitHard_Voices[math.random(1, #HitHard_Voices)], 90, 100)
					local gore = ents.Create("gore")
					gore:SetPos(ent:GetPos() + Vector(0, 0, 40))
					gore:Initialize()
					gore:SetMode("smallhit")
				end
			elseif(dt > 35)then
				ent:EmitSound(HitMega[math.random(1, #HitMega)], 110, 100+math.random(-10,10))
				ent.NextDamageSound = CurTime() + DamageSoundDelay
				if(ent.NextVoice < CurTime())then
					ent.NextVoice = CurTime() + VoiceDelay
					ent:EmitSound(HitHard_Voices[math.random(1, #HitHard_Voices)], 90, 100)
					local gore = ents.Create("gore")
					gore:SetPos(ent:GetPos() + Vector(0, 0, 40))
					gore:Initialize()
					gore:SetMode("bighit")
					ParticleEffect( "player_blood", ent:GetPos() + Vector(0, 0, 45), Angle(0,0,0), ent )	
				end
			end
		end
	end
end


